<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>学员周报</title>
    <link rel="stylesheet" href="media/layui/css/layui.css">
</head>
<body>
<form action="" type="get">
    <table>
        <tr>
            <td><label style="color:red"> 学员姓名： </label></td>
            <td><span id="uname"></span></td>
        </tr>

        <tr>
            <td><label style="color:red"> 周报标题： </label></td>
            <td><input type="text" placeholder="请输入标题" name="title"></td>
        </tr>
        <tr>
            <td><label style="color:red"> 周报内容： </label></td>
        </tr>

        <tr>
            <td></td>
            <td><textarea placeholder="请输入周报内容" style="width:592px;height:150px;" id="content" name="content"></textarea></td>
        </tr>
    </table>

    <button type="submit" class="layui-btn">添加</button>
   <!-- <div class="layui-btn-group">

        <button type="button" class="layui-btn">返回</button>
    </div>-->
</form>
<script src="media/layui/layui.js"></script>
<script src="media/js/jquery.min.js"></script>
<script>

    $("form").submit(function () {
        $.ajax({
            type:"get",
            url:"http://localhost:8080/OaNew/week/add.do",
            data:$("form").serialize(),
            success:function (data) {
               alert(data.info)
                window.location.reload()
            }
        })
        return false
    })

    $(function () {
        $.ajax({
                type: "get",
                url: "http://localhost:8080/OaNew/user/query.do",
                dataType: "json",
                success: function(data) {
                console.log(data)
                if (data.code == 1) {
                    $("#uname").html(data.info)
                } else {
                    layer.msg("获取数据异常")
                }
            }
        })
    })
</script>
</body>
</html>
